#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>
int main()
{
  if(fork()==0){
  printf("command begin!\n");


  //execl("/usr/bin/ls","ls","-a","-l",NULL);
  //
  //
  //
  
  char *argv[]={
    "ls",
    "-a",
    "-l",
      NULL

  };
  //execv("/usr/bin/ls",argv);
  
  
  //execlp("ls","ls","-a","-l",NULL);
  
  //execvp("ls",argv);
  
 //用我的程序执行我的程序 
 // execl("./myexe","myexe",NULL);
 //
 //
 //
  //可以自定义环境变量
  char *env[][64]={
    "MYENV=HHHHHHHHHHHH",
    "MYENV=HHHHHHHHHHHH",
    "MYENV=HHHHHHHHHHHH",
  };
  execle("./myexe","myexe",NULL,env);
  printf("end!\n");
  exit(1);
  }

  waitpid(-1,NULL,0);
  printf("wait child success!\n");
  return 0;
}
